package com.addplus.townmall.server.api.mapper.town;

import com.addplus.townmall.server.api.model.town.expand.ShopProductExpand;
import com.addplus.townmall.server.api.utils.BaseAddMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ShopProductExpandMapper extends BaseAddMapper<ShopProductExpand> {

    @Select("select cart.id as shop_member_cart_id,cart.quantity,cart.gmt_modified,cart.shop_sku_id,shop.id shop_id,shop.shop_name,shop.cost_price,shop.shop_seal_img,store.id store_id,store.store_name,sku.id shopSpecificationSkuId,sku.sku_id " +
            "from shop_member_cart cart,shop_product shop,store,shop_specification_sku sku " +
            "where cart.member_id=${memberId} and cart.is_delete=0 and cart.shop_id=shop.id and cart.store_id=store.id and cart.shop_sku_id=sku.id order by cart.gmt_create desc")
    List<ShopProductExpand> getShopByMemberId(Page page, @Param("memberId")Integer memberId);
}
